<?php
class User_model extends MY_Model{

    function __construct()
    {
        parent::__construct();
        $this->_table        =    'users';   //ten table trong db
        $this->primary_key    =    'user_id';     //khoa chinh
    }
    
    function get_limit($limit = 10, $offset = 0,$where = array())
    {
    	if($where)
    	{
    		$this->db->like($where);
    	}
    	$rows	=	$this->db->select()->from($this->_table)->order_by('created_on DESC')->limit($limit,$offset)->get()->result();
    	$result['rows']	=	$rows;
    	if($where)$this->db->like($where);
    	$num_rows	=	$this->db->select('count(user_id) as cnt')->from($this->_table)->get()->row()->cnt;
    	$result['num_rows']	=	$num_rows;
    	return $result;
    }
}